<?php if (!defined('THINK_PATH')) exit();?> <!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/bootstrap.css">
    
    <link rel="stylesheet" type="text/css" href="/TPproject/project/Public/Admin/Css/theme.css">
    <link rel="stylesheet" href="/TPproject/project/Public/Admin/Css/font-awesome.css">

    <script src="/TPproject/project/Public/Admin/Js/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/Js/layer.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="/TPproject/project/Public/Admin/static/h-ui.admin/js/H-ui.admin.js"></script>

    <script src="/TPproject/project/Public/Admin/Js/jquery.validation/jquery.validate.js" type="text/javascript"></script>


    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height:300px;
            width:800px;
            margin: 0px auto;
            margin-top: 1em;
        }
        .brand { font-family: georgia, serif; }
        .brand .first {
            color: #ccc;
            font-style: italic;
        }
        .brand .second {
            color: #fff;
            font-weight: bold;
        }
        .table>thead>tr>th
        {
          text-align: center;
        }
        .table>tbody>tr>td
        {
          text-align: center;
        }
    </style>



 
    <link rel="shortcut icon" href="/TPproject/project/Public/Admin/Img/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/TPproject/project/Public/Admin/Img/apple-touch-icon-57-precomposed.png">
  </head>
  <body class=""> 
    
    <div class="navbar">
        <div class="navbar-inner">
                <ul class="nav pull-right">
                    
                    <li><a href="#" class="hidden-phone visible-tablet visible-desktop" role="button">设置</a></li>
                    <li id="fat-menu" class="dropdown">
                        <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                            <i class="icon-user"></i><?php echo (session('manage_name')); ?>
                            <i class="icon-caret-down"></i>
                        </a>

                        <ul class="dropdown-menu">
                            <li><a tabindex="-1" href="#">My Account</a></li>
                            <li class="divider"></li>
                            <li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
                            <li class="divider visible-phone">...</li>
                            <li><a tabindex="-1" href="<?php echo U('Manage/logout');?>">退出</a></li>
                        </ul>
                    </li>
                    
                </ul>
                <a class="brand" href="index.html"><span class="first">Your</span> <span class="second">Company</span></a>
        </div>
    </div>
    


    

     
    
    <div class="sidebar-nav">

        <form class="search form-inline" >
            <input type="" placeholder="搜索..." name="search" oninput="sch(this)">
        </form>

        <a href="<?php echo U('Admin/Index/index');?>" class="nav-header" data-toggle="collapse1"><i class="icon-dashboard"></i>首页</a>

        <ul id="dashboard-menu" class="nav nav-list collapse in">
        </ul>

        
        <?php if(is_array($li)): $i = 0; $__LIST__ = $li;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i; if($vo['auth_name'] != 首页): ?><a href="#<?php echo ($vo["auth_id"]); ?>" class="nav-header collapsed" data-toggle="collapse"><i class="icon-exclamation-sign"></i><?php echo ($vo["auth_name"]); ?> <i class="icon-chevron-up"></i></a>

                <ul id="<?php echo ($vo["auth_id"]); ?>" class="nav nav-list collapse">
                    <?php if(is_array($vo['child'])): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i; $controller = $vol['auth_controller']; $action = $vol['auth_action']; ?>
                        <li ><a href='<?php echo U("Admin/$controller/$action");?>'><?php echo ($vol["auth_name"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
                </ul><?php endif; endforeach; endif; else: echo "" ;endif; ?>
        

        

        <a href="#legal-menu" class="nav-header" data-toggle="collapse"><i class="icon-legal"></i>Legal</a>
        <ul id="legal-menu" class="nav nav-list collapse">
            <li ><a href="privacy-policy.html">Privacy Policy</a></li>
            <li ><a href="terms-and-conditions.html">Terms and Conditions</a></li>
        </ul>

        <a href="help.html" class="nav-header" ><i class="icon-question-sign"></i>Help</a>
        <a href="faq.html" class="nav-header" ><i class="icon-comment"></i>Faq</a>
    </div>
    <script type="text/javascript">


        
    </script>

<div class="content">
        
        <div class="header">
            
            <h1 class="page-title">权限列表</h1>
        </div>
        
                  

        <div class="container-fluid">
            <div class="row-fluid">
                    
<div class="btn-toolbar">
    <a href="javascript:;" onclick="append('新增权限','<?php echo U('Admin/Auth/append');?>','800','400')"><button class="btn btn-primary"><i class="icon-plus"></i>新增权限</button></a>
    
  <div class="btn-group">
  </div>
</div>
<div class="well">
    <table class="table">
      <thead>
        <tr>
          <th style="width: 80px;">#</th>
          <th>权限名称</th>
          <th>权限模块</th>
          <th>权限控制器</th>
          <th>权限方法</th>
          <th>权限管理</th>
        </tr>
      </thead>

      <tbody>

        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
          <!-- <?php if($vo["status"] == 1): ?><td><span style="background-color: green;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">已设置</span></td>
          <?php else: ?>
            <td><span style="background-color: red;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">未设置</span></td><?php endif; ?> -->
          <td>#</td>
          <td style="text-align: left"><?php echo ($vo["auth_name"]); ?></td>
            
          <td><?php echo ($vo["auth_module"]); ?></td>
          <td><?php echo ($vo["auth_controller"]); ?></td>
          <td><?php echo ($vo["auth_action"]); ?></td>

          <td>
          
              <a href="javascript:;" onclick="edit('权限修改','<?php echo U('Admin/Auth/edit',array('auth_id'=>$vo['auth_id']));?>','<?php echo ($vo["auth_id"]); ?>','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
              <a href="javascript:;"  onclick="del_auth('<?php echo U('Admin/Auth/del');?>','<?php echo ($vo["auth_id"]); ?>')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
          </td>
        </tr>
          <?php if(is_array($vo['child'])): $i = 0; $__LIST__ = $vo['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vol): $mod = ($i % 2 );++$i;?><tr>
                <td>#</td>
                <td style="text-align: left">&nbsp; |`<?php echo ($vol["auth_name"]); ?></td>
                <td><?php echo ($vol["auth_module"]); ?></td>
                <td><?php echo ($vol["auth_controller"]); ?></td>
                <td><?php echo ($vol["auth_action"]); ?></td>
                <td>
                  <a href="javascript:;" onclick="edit('角色属性修改','<?php echo U('Admin/Auth/edit',array('auth_id'=>$vol['auth_id']));?>','<?php echo ($vol["auth_id"]); ?>','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
                  <a href="javascript:;"  onclick="del_auth('<?php echo U('Admin/Auth/del');?>','<?php echo ($vol["auth_id"]); ?>')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
                </td>
            
            </tr>
            <?php if(is_array($vol['child'])): $i = 0; $__LIST__ = $vol['child'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$voli): $mod = ($i % 2 );++$i;?><tr>
                <td>#</td>
                <td style="text-align: left">&nbsp; &nbsp; |`|`<?php echo ($voli["auth_name"]); ?></td>
                <td><?php echo ($voli["auth_module"]); ?></td>
                <td><?php echo ($voli["auth_controller"]); ?></td>
                <td><?php echo ($voli["auth_action"]); ?></td>
                <td>
                  <a href="javascript:;" onclick="edit('角色属性修改','<?php echo U('Admin/Auth/edit',array('auth_id'=>$voli['auth_id']));?>','<?php echo ($voli["auth_id"]); ?>','800','400')"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a>
              
                  <a href="javascript:;"  onclick="del_auth('<?php echo U('Admin/Auth/del');?>','<?php echo ($voli["auth_id"]); ?>')" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a>
                </td>
              </tr><?php endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; endforeach; endif; else: echo "" ;endif; ?>
      
      </tbody>
    </table>
</div>
<div class="pagination">
    <ul>
        <?php echo ($page); ?>
    </ul>
</div>

<script type="text/javascript">
   function append(title,url,w,h){
      layer_show(title,url,w,h);
   }
   function edit(title,url,id,w,h){
      layer_show(title,url,w,h);
   }

   function del_auth(url,auth_id){

      layer.confirm('确定要删除吗',function(index){
        $.ajax({
          type:'POST',
          url: url ,
          dataType:'json',
          data:{auth_id : auth_id},
          success: function(data){
            // alert(data);return false;
            if(data.code==1){

              layer.msg(data.info,{icon:1,time:1000},function(){
                location.href = "<?php echo U('showlist');?>";
              });
              
            }else{
              layer.msg(data.info,{icon:2,time:1000});
              return false;
            }
            
          },
          error:function(data){
            
          }

        })
      });
   }

   //搜索
  function sch(obj){

            var search = $(obj);
            var content = search.val();
            // alert(content);return false;
            
            $.ajax({
                  type:'POST',
                  url: '' ,
                  data:{search:content},
                  dataType:'json',
                  success: function(data){
                    // for(var i = 0;i<data.length;i++){
                    //   alert(data[i].status);return false;
                    // }
                    
                    var list = '';
                    for(var i = 0;i<data.length;i++){
                      var append = "append('新增管理员','<?php echo U('Admin/Proattr/append',array('pro_id'=>"+data[i].pro_id+"));?>','800','400')";


                      var edit = "edit('产品属性修改','<?php echo U('Admin/Proattr/edit',array('pro_id'=>"+data[i].pro_id+"));?>','<?php echo ($vo["pro_id"]); ?>','800','400')";

                      var del = "del_attr('del?attr_id="+data[i].pro_id+"')";
                      
                      list += '<tr>';
                      if(data[i].status==1){
                        list +='<td><span style="background-color: green;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">已设置</span></td><td>';
                      }else{
                        list +='<td><span style="background-color: red;color:white;border-radius:10px;padding-left: 10px;padding-right: 10px">未设置</span></td><td>';
                      }
                      list += data[i].pro_name+'</td><td>'+data[i].catename+'</td><td>'+data[i].create_time+'</td>';
                      
                      list += '<td><a href="javascript:;" onclick="'+append+'"><button class="btn btn-primary"><i class="icon-plus"></i></button></a><a href="javascript:;" onclick="'+edit+'"><button class="btn btn-primary"><i class="icon-pencil"></i></button></a><a href="javascript:;"  onclick="'+del+'" role="button" data-toggle="modal"><button class="btn btn-primary"><i class="icon-remove"></i></button></a></td></tr>';
                    }
                    
                    
                    
                    
                    $('tbody').html(list);
                  },
                  error:function(data){
                    
                  }

            })
       }
   
   
</script>

              

    
  
<script src="/TPproject/project/Public/Admin/Js/bootstrap.js" type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function() {
        $('.demo-cancel-click').click(function(){return false;});
    });
</script>